package com.baiyi.homeui.hshomeui.entity;

import android.text.TextUtils;

import com.baiyi.homeui.hshomeui.manage.MsgReceiverManager;

public class PcCpu {

      /*{
                "cpu": {
                "load": 71, // 负载 %
                "temperature": 82.8, // 温度 °C
                "fanAverage": 570, // ⻛扇平均速度
                "speedAverage": 3773, // CPU速度 MHz
                "power": 71 // 电源 W
                 },
                "gpu": {
                "load": 3, // 负载 %
                "temperature": 57, // °C
                "speed": 38, // GPU速度 MHz
                "fan": 0, // ⻛扇速度
                "power": 12 // 电源 W
                 },
                "disk": {
                "load": 31, // 负载：使⽤率
                "used": 124, // GB
                "total": 476, // GB
                "used": 124, // GB
                "activity": 7, // %
                "temperature": 51, // °C
                "readSpeed": 24662, // KB/s
                "writeSpeed": 407 // KB/s
                 },
                "memory": {
                "load": 93, // 负载：使⽤率
                "used": 15007, // MB
                "total": 16384 // MB
                 },
                "network": {
                "upload": 0, // kb
                "download": 0 // kb
                 },
                "fans": {
                "items": [
                 {
                "name": "Fan #1", // 名字
                "value": 570, // 当前值
                "max": 1906
                 }
                 ],
                当前阶段返回的数据
                响应：
                响应码：200
                响应体：None
                CPU 状态
                请求：
                ⽅法：STATE
                命令：cpu
                响应：
                响应码：200
                响应体：None
                "average": 1898
                 }
                }*/
    private int load;
    private float temperature;
    private int fanAverage;
    private int speedAverage;
    private int power;

    private float voltage;

    public float getVoltage() {
        return voltage;
    }

    public void setVoltage(float voltage) {
        this.voltage = voltage;
    }

    public int getLoad() {
        return load;
    }

    public void setLoad(int load) {
        this.load = load;
    }

    public int getTemperature() {
        if(!TextUtils.isEmpty(MsgReceiverManager.temp_unit)&&MsgReceiverManager.temp_unit.equals("Fahrenheit")){
            return (int) ((temperature *1.8) + 32);
        }
        return (int)temperature;
    }

    public void setTemperature(float temperature) {
        this.temperature = temperature;
    }

    public int getFanAverage() {
        return fanAverage;
    }

    public void setFanAverage(int fanAverage) {
        this.fanAverage = fanAverage;
    }

    public int getSpeedAverage() {
        return speedAverage;
    }

    public void setSpeedAverage(int speedAverage) {
        this.speedAverage = speedAverage;
    }

    public int getPower() {
        return power;
    }

    public void setPower(int power) {
        this.power = power;
    }

    @Override
    public String toString() {
        return "PcCpu{" +
                "load=" + load +
                ", temperature=" + temperature +
                ", fanAverage=" + fanAverage +
                ", speedAverage=" + speedAverage +
                ", power=" + power +
                ", voltage=" + voltage +
                '}';
    }
}
